<template>
  <Card>
    <p slot="title">消防设施器材损耗情况</p>
    <div class="chart" id="chart-facilities-damaged"></div>
    <Divider />
    <span class="text">完好率：{{percentage}}%</span>
    <Spin v-show="loading" fix size="large" />
  </Card>
</template>

<script>
export default {
  name: "",
  data() {
    return {
      percentage: 0,
      option: null,
      loading: false
    };
  },
  methods: {
    renderChart() {
      this.loading = true;
      this.option = {
        legend: {
          data: ["运作正常", "已损坏","维修中"],
          left: "center",
          top: "top",
          orient: "horizontal"
        },
        color: [this.COLORS[6], this.COLORS[0],this.COLORS[3]],
        series: [
          {
            type: "pie",
            radius: ["35%", "50%"],
            center: ["50%", "50%"],
            itemStyle: {
              normal: {
                shadowColor: "#00000020",
                shadowBlur: 12,
                shadowOffsetX: 0,
                shadowOffsetY: 5
              }
            },
            label: {
              normal: {
                show: true,
                position: "outisde",
                formatter: "{b}:\n{c}个"
              }
            },
            data: [
              { name: "运作正常", value: 0 },
              { name: "已损坏", value: 0 },
              {name:'维修中',value:0}
            ]
          }
        ]
      };
      this.$Crender("chart-facilities-damaged", this.option);
      this.loading = false;
    }
  },
  mounted() {
      this.renderChart();
  },
};
</script>

<style scoped>
.chart{
    height:410px;
}
</style>